Auto merge of #3542 - creativcoder:check-digit-name, r=alexcrichton
authorbors <bors@rust-lang.org>
Tue, 17 Jan 2017 02:48:37 +0000 (02:48 +0000)
committerbors <bors@rust-lang.org>
Tue, 17 Jan 2017 02:48:37 +0000 (02:48 +0000)
Add a check for names starting with a digit

According to Rust grammer https://doc.rust-lang.org/grammar.html#extern-crate-declarations for extern crate declarations, a crate name cannot start with a digit.

But, currently this rule is not upheld by `cargo new` as creating a project like:

`cargo new 2048` would create a project named 2048 which obviously won't compile with crate declaration like `extern crate 2048` by a consumer.

This obviously is a rare case in practice, but its always good to check i guess.

This PR adds a check to the `new` method and `bail`s out with a message for any names starting with a digit.

PS: I noticed it while making a 2048 puzzle game as a library so thought it would be nice to add this check :)


Trivial merge